package org.surelink.radius.server;

import org.surelink.radius.console.ConsoleHandler;
import org.xsocket.connection.IConnection;
import org.xsocket.connection.Server;
import java.io.IOException;

public class ConsoleServer {

    private Server server;

    public ConsoleServer(int port, ConsoleHandler handler) throws IOException {
        server = new Server(port,handler);
        server.setAutoflush(true);
        server.setFlushmode(IConnection.FlushMode.ASYNC);
        server.setMaxConcurrentConnections(1024);
        server.setServerName("ConsoleServer");
        server.setStartUpLogMessage("ConsoleServer startup");
        server.start();
    }


    public void stop()
    {
        server.close();
    }

}
